/*************************************************************************
	> File Name: server.c
	> Author: 
	> Mail: 
	> Created Time: 03 July 2018 06:32:46 PM PDT
 ************************************************************************/

#include<stdio.h>
#include "./include/sreialPort.h"
#include "./include/net.h"
#include "./include/sendpicture.h"
int sendQt = -1;
void *threadFunc1(void *arg)
{	puts("tttttttttttt");
	if(M0_OK != InitM0(sendQt))
	{
		printf("initM0 error\n");
	}
}

int main()
{
	int socketID;
	pthread_t threadID;
	pthread_mutex_init(&mutext,NULL);
	pthread_mutex_init(&mutext1,NULL);
	socketID = initSocket();//启动服务器
	if (DB_OK != InitDb())
	{
		return DB_ERR;
	}
	printf("初始化数据库完成!\n");
	int ret = pthread_create(&threadID, NULL, threadFunc1, NULL);
    if(ret != 0)
    {
        printf("create pthread error!\n");
        return -1;
    }

	AcceptClient(socketID,&sendQt);//等待客户端连接
	//pthread_join(threadID,NULL);
	//pthread_join(threadID2,NULL);
	pthread_join(threadID3,NULL);
	return 0;
}
